<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    x:Class="OpenLS.Spreadsheet.UI.Internals.ReflectionResources"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Reflection="clr-namespace:System.Reflection;assembly=mscorlib"
    xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI">
    <DataTemplate DataType="{x:Type Reflection:ParameterInfo}">
        <ContentControl Content="{Binding Member}" Internals:EditionElement.Parameter="{Binding}"/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type Reflection:ParameterInfo}" x:Key="parameterInfo">
        <StackPanel Orientation="Horizontal">
            <StackPanel Orientation="Horizontal" Name="panel">
               <TextBlock Text="[" Name="before"/>
                <TextBlock Text="{Binding Name}"></TextBlock>
                <TextBlock Text="]" Name="after"/>
            </StackPanel>
            <TextBlock Text="," Name="comma"/>
        </StackPanel>
        <DataTemplate.Triggers>
            <DataTrigger Value="True">
                <DataTrigger.Binding>
                    <Binding>
                        <Binding.Converter>
                            <Internals:IsLastParameterConverter>
                        </Internals:IsLastParameterConverter></Binding.Converter>
                    </Binding>
                </DataTrigger.Binding>
                <Setter TargetName="comma" Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
            <DataTrigger Value="False">
                <DataTrigger.Binding>
                    <Binding>
                        <Binding.Converter>
                            <Internals:IsOptionalParameterConverter />
                        </Binding.Converter>
                    </Binding>
                </DataTrigger.Binding>
                <Setter TargetName="before" Property="Visibility" Value="Collapsed"/>
                <Setter TargetName="after" Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
            <DataTrigger Value="True">
                <DataTrigger.Binding>
                    <MultiBinding>
                        <MultiBinding.Converter>
                            <ssui:MultiEqualConverter />
                        </MultiBinding.Converter>
                        <Binding></Binding>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(Internals:EditionElement.Parameter)"></Binding>
                    </MultiBinding>
                </DataTrigger.Binding>
                <Setter TargetName="panel" Property="TextElement.FontWeight" Value="Bold"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
    <DataTemplate DataType="{x:Type Reflection:MethodInfo}">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Name}"/>
            <TextBlock Text="("/>
            <ItemsControl ItemTemplate="{StaticResource parameterInfo}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemsSource>
                    <Binding>
                        <Binding.Converter>
                            <Internals:MethodInfoToParametersConverter/>
                        </Binding.Converter>
                    </Binding>
                </ItemsControl.ItemsSource>
            </ItemsControl>
            <TextBlock Text=")"/>
        </StackPanel>
    </DataTemplate>


</ResourceDictionary>